package dev.mrchen.flows.core.cmd;

import dev.mrchen.flows.core.DataLevel;
import dev.mrchen.flows.core.Executor;
import dev.mrchen.flows.core.FlowData;
import dev.mrchen.flows.core.FlowInfo;

public class SetValueExecutor implements Executor {

    private final DataLevel level;

    private final String key;

    private final Object value;

    public SetValueExecutor(DataLevel level, String key, Object value) {
        this.level = level;
        this.key = key;
        this.value = value;
    }


    @Override
    public void execute(FlowInfo nextFlow, FlowData data) throws Exception {
        data.setData( level , key , value );
        nextFlow.next(data);
    }
}
